/* 
 * File:   decoder.hpp
 * Author: grm
 *
 * Created on 31 mars 2011, 20:56
 */

#ifndef DECODER_HPP
#define	DECODER_HPP

extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}

class Decoder {
private:
    char* filename;
    int width;
    int height;
    int videoStream;
    int imageBufferSize;
    AVFormatContext *pFormatCtx;
    AVCodecContext *pCodecCtx;
    AVFrame * pFrame;
    struct SwsContext * img_convert_ctx;
    bool streamDecoded;
    

public:
    Decoder(char* input_video_file, int width = 2048, int height = 1080);
    ~Decoder();
    AVFrame * getNextVideoFrame(uint8_t* buffer);
    int getFrameSize();
    bool stillHasFrame();
};

#endif	/* DECODER_HPP */

